<template>
	<view>

	</view>
</template>

<script>
	export default {
		data() {
			return {

			};
		},
		onLoad() {
			this.getDate();
		},
		methods: {
			getDate: function() {
				// 寻找正在进行中的订单
				this.$api.getAllCycleOrder({
						pay_status: 2
					})
					.then(res => {
						if (res.data.length == 0) {
							this.$db._ShowToast('您暂无进行中的订单，请先去下单', () => {
								this.$db._NavTo('index', {}, this.$db.navToMethod[2])
							})
							return false;
						}
						for (let v of res.data) {
							let now_date = new Date().getTime();
							if (now_date > v.p_time * 1000) {
								this.$db._NavTo('submited-order-page', {
									order_id: v.order_id,
									type: 2
								}, this.$db.navToMethod[1])
								return false;
							}
						}
						// 没有找到正在进行中的订单
						this.$db._NavTo('submited-order-page', {
							order_id: res.data[0].order_id,
							type: 2
						}, this.$db.navToMethod[1])
					})
			},
		}
	}
</script>

<style lang="scss">

</style>
